Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI: Fixes for Gradio 4.7.1/4.8.0 update #2024

Merged
merged 1 commit into from
Dec 14, 2023

Conversation

one-lithe-rune
Copy link
Contributor

@one-lithe-rune one-lithe-rune commented Dec 6, 2023

Changes

  • Upgrade Gradio pin from 4.7.1 to 4.80.
  • Make Nod AI logos visible again.
  • Remove image toolbars from png import boxes.
  • Set Input Images on img2img, outpaint and upscaler tabs to be upload only.
  • Change Image control to an ImageEditor control for masking on the inpaint tab. Remove previous height restriction as this hides the editing controls.
  • Move Input Image/Masked Image on img2img, inpaint, outpaint and upscaler tabs to be the first control on their tabs.
  • Remove download buttons from all galleries as they download some html rather the image (gradio issue #6595)
  • Remove add new row and column from Output Gallery parameters dataframe.
  • Add partial workaround for not being able to select text in the Output Gallery Gallery parameters dataframe (gradio issue #6086 )
  • Fix uglified formatting of subdirectory selection dropown, refresh button, and open folder buttons on the Output Gallery tab.
  • Force Output Gallery to use the full width of the Gallery control for the preview overlay when an image is selected, rather than an overlay the width of the selected image.
  • Fix sendto buttons.

Problems/Concerns/Known Issues

  • Generating on the Inpaint tab for an image sent with one of the 'SendTo' buttons rather than being uploaded, will remove and then re-add any mask you set. With batches the mask will semi-randomly appear and disappear after each image until the batch is completed.
  • I've had to disable updating of the Output Gallery from the Inpaint tab, as that triggers the mask disappearing completely when you generate.
  • Inpainting is therefore pretty crufty both visually and in terms of the code I've had to add to workaround these problems. But it now does actually work again.

ToDo

  • Fix Inpainting Tab Generation.

@one-lithe-rune
Copy link
Contributor Author

one-lithe-rune commented Dec 6, 2023

Any ideas on what needs to be converted between what the the inpainting pipeline is expecting and what the ImageEditor is providing gratefully received. I've resolved the obvious dictionary naming conflicts for the parameters passed in, but the actual image formats seem to be the problem.

@monorimet
Copy link
Collaborator

@one-lithe-rune you can refer to my changes to img2img UI for how to handle most of this.
latest version is here: #2025

@monorimet
Copy link
Collaborator

Thank you for the help with this. I was very sad to have broken the buttons.

@monorimet
Copy link
Collaborator

Note: We'll be moving a lot of the guts of SHARK studio elsewhere, and I don't know how much of this UI will be kept. Any ideas on consolidating features / UI representations would be massively appreciated. Let's try and simplify as we go (despite my adding a bunch of stuff for multicontrolnet...)

for example :: we dont need a tab for each feature of SD.
We can have txt2img and img2img if really needed, but inpaint/outpaint definitely dont need it.

}
I mean to rework the pipelines to reduce code overlap, and a lot of that will be coming with Studio 2.0..

Anything you have in a working state, I'll happily migrate to the new version, but just FYI that we'll be reworking a lot of the UI soon.

@one-lithe-rune
Copy link
Contributor Author

one-lithe-rune commented Dec 7, 2023

Note: We'll be moving a lot of the guts of SHARK studio elsewhere, and I don't know how much of this UI will be kept. Any ideas on consolidating features / UI representations would be massively appreciated. Let's try and simplify as we go (despite my adding a bunch of stuff for multicontrolnet...)

@monorimet Yeah, I was expecting that, since it at least all needs moving out of the the Stable Diffusion folder structure and rebuilding under Shark Studio for Turbine.

Ditching the tabs and having mostly one UI for SD has long been something I've thought about, ever since I did the output gallery, with its left/right split. Extending that so all the visual input image/edited image/gallery stuff is on one side of the UI, and then the other side is parameters and selection stuff for whatever you're working on, with the operation you're doing (i.e txt2img) being picked picked from a dropdown. If there were tabs it would just be for selecting which of gallery/input image/mask/intermediate image you needed to see and would be restricted that section of the UI.

The other thing I think is really needed to clean up the interface, is a revamped model manager as a separate part of the UI. It would be where you specify all the things needed for AOT compile -- so model to use for txt2img/img2img, inpaint/outpaint, vae, lora's, available sizes, big/little unet, tuned/untuned, which schedulers are sensible etc. Then in the main UI you'd just pick from the configs you'd defined there. Obviously we would need to be able to auto-generate some to get you started, and generate template ones for new models. It would also ideally tell you what was downloaded/not downloaded, built not/built for a config, and let you fire off and monitor builds without always having to do them lazily.

I assume LLM could use such a thing but with different settings. But I confess, I don't use SHARK for LLM.

Of course some of that might be moot depending on how AOT Turbine is/wants to be. I gather it can do more JIT stuff than currently?

The model manager/config stuff has been getting really itchy for me, especially with multi-LoRA being an obvious extension to what I've been working on recently. I keep running into 'and how long is a .vmfb filename going to be now?' and 'Windows has a 260 character path length limit, unless you do registry edits, doesn't it?' when I think about it.

@one-lithe-rune
Copy link
Contributor Author

one-lithe-rune commented Dec 8, 2023

Okay, I have inpainting 'working' again. Albeit messily.

I haven't been able to find what in my code or gradio that triggering the underlying problem that I'm having to work around (the mask layer being deleted from the ImageEditor when you trigger something that reads/use the mask). I think its possibly some queuing thing, but I dunno 🤷

Setting this as ready for review, since its 'working' and it would be good to get the other stuff in as well.

@one-lithe-rune one-lithe-rune marked this pull request as ready for review December 8, 2023 22:44
* Upgrade Gradio pin from 4.7.1 to 4.80.
* Make Nod AI logos visible again.
* Remove image toolbars from png import boxes.
* Set Input Images on img2img, outpaint and upscaler tabs to be upload
only.
* Change Image control to an ImageEditor control for masking on the
inpaint tab. Remove previous height restriction as this hides the
editing controls.
* Move Input Image/Masked Image on img2img, inpaint, outpaint and
upscaler tabs to be the first control on their tabs.
* Remove download buttons from all galleries as they download some
html rather the image (gradio issue #6595)
* Remove add new row and column from Output Gallery parameters
dataframe.
* Add partial workaround for not being able to select text in the Output
Gallery Gallery parameters dataframe (gradio issue #6086 )
* Fix uglified formatting of subdirectory selection dropown, refresh
button, and open folder buttons on the Output Gallery tab.
* Force Output Gallery to use the full width of the Gallery control
for the preview overlay when an image is selected, rather than
an overlay the width of the selected image.
* Fix sendto buttons.
* Reset Inpaint ImageEditor control with the Mask Layer after generation
is complete, as it gets lost if the image was sent to the tab from
another tab rather than being uploaded. Also rework queuing and
progress rendering along this codepath. This doesn't solve the
underlying problem of the Mask Layer being removed, but does get inpaint
fully working with the Gradio update.
@one-lithe-rune
Copy link
Contributor Author

Rebased and squashed, after some rework of the queuing and progress rendering along the inpaint UI generation codepath, that allows re-enabling of output gallery updates for inpaint.

@one-lithe-rune
Copy link
Contributor Author

Any chance of getting this reviewed and merged?

I would bring it up to Gradio 4.9.0, but I can't get that version respect css @media queries atm, so I'm going to have to file a bug with upstream and see what comes of it before I can progress things beyond 4.8.0.

Copy link
Collaborator

@monorimet monorimet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@monorimet monorimet merged commit f692a01 into nod-ai:main Dec 14, 2023
6 checks passed
@one-lithe-rune one-lithe-rune deleted the ui_gradio_480_fixes branch December 30, 2023 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants